-
Notifications
You must be signed in to change notification settings - Fork 1.2k
RUM-9755: Add Jetpack Compose Instrumentation documentation #29110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Preview links (active after the
|
e3fd731
to
a831dc4
Compare
319bef2
to
6fe16fd
Compare
As described in the [Setup section][2], declare the [Datadog Gradle Plugin][3] in your build script and apply it to each module you want to instrument. | ||
|
||
<div class="alert alert-info"><p> | ||
The Datadog Gradle Plugin scans @Composable functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects NavHost usage and listens to Jetpack Compose navigation events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You might want to put @Composable
and NavHost
in quotes so that it is shown as code. You do it in other places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
alert alert-info
doesn't support markdown inside, that's why I remove it delibrately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, you could do this:
The Datadog Gradle Plugin scans @Composable functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects NavHost usage and listens to Jetpack Compose navigation events. | |
The Datadog Gradle Plugin scans <code>@Composable</code> functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects <code>NavHost</code> usage and listens to Jetpack Compose navigation events. |
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Show resolved
Hide resolved
6fe16fd
to
91868a1
Compare
Created docs card for docs review: https://datadoghq.atlassian.net/browse/DOCS-10800 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm, I left few suggestions
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
.../en/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation.md
Outdated
Show resolved
Hide resolved
91868a1
to
8d09a89
Compare
{{% /tab %}} | ||
{{< /tabs >}} | ||
|
||
### Step 2 - Enable actions tracking option in `RumConfiguration` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm slightly confused as to why this is a required step.
What if customer's don't want action tracking and just want view tracking?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
More technically speaking, this is a structure limitation of our SDK, we need to make user call this API to let our dd-sdk-android-rum
module knows that user has already imported dd-sdk-android-compose
module in their app, then dd-sdk-android-rum
can use the compose related logic to track actions.
If customer doesn't want Compose action tracking, they can just not call it. should I mention explicitly in this part?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ambushwork, thank you for this PR! Aside from some of the suggestions I've made, I have a few questions:
- would love to know your thoughts on moving this content and putting it as a tab on the Android setup page similar to how we document setup for React Native and related frameworks. I'm not sure how customers think about this framework in particular, how popular it is, and realize it might impact searchability. But at the same time, I'm not sure if it makes sense sitting between Integrated Libraries and Troubleshooting at the moment.
- are there any additional steps after instrumentation that we should add, such as re-initializing the application?
Let me know if you have any questions about my feedback and/or submit a re-request for review.
@@ -33,4 +33,5 @@ To get started with RUM for Android, create an application and configure the And | |||
<u>Integrated Libraries</u>: Import integrated libraries for your Android and Android TV applications.{{< /nextlink >}} | |||
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/troubleshooting">}} | |||
<u>Troubleshooting</u>: Common troubleshooting Android SDK issues.{{< /nextlink >}} | |||
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation">}}<u>Jetpack Compose Instrumentation</u>: Instrument Jetpack Compose manually or automatically using the Datadog Gradle Plugin. {{< /nextlink >}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{{< nextlink href="/real_user_monitoring/mobile_and_tv_monitoring/android/jetpack_compose_instrumentation">}}<u>Jetpack Compose Instrumentation</u>: Instrument Jetpack Compose manually or automatically using the Datadog Gradle Plugin. {{< /nextlink >}} |
## Overview | ||
If your application uses Jetpack Compose, you can instrument it manually or automatically with the Datadog Gradle Plugin. This enables Real User Monitoring (RUM) similar to what is available for Android classic Views. | ||
|
||
<div class="alert alert-info"><p>Note: The minimum supported Kotlin version is 1.9.23.</p></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<div class="alert alert-info"><p>Note: The minimum supported Kotlin version is 1.9.23.</p></div> | |
<div class="alert alert-info"><p>The minimum supported Kotlin version is 1.9.23.</p></div> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removing "note" since it's already in an alert box
text: Explore Datadog RUM | ||
--- | ||
## Overview | ||
If your application uses Jetpack Compose, you can instrument it manually or automatically with the Datadog Gradle Plugin. This enables Real User Monitoring (RUM) similar to what is available for Android classic Views. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If your application uses Jetpack Compose, you can instrument it manually or automatically with the Datadog Gradle Plugin. This enables Real User Monitoring (RUM) similar to what is available for Android classic Views. | |
Jetpack Compose is a toolkit for building native UI in Android. If your application uses Jetpack Compose, you can instrument it manually or automatically with the Datadog Gradle Plugin. This enables Real User Monitoring (RUM) similar to what is available for Android classic Views. |
|
||
## Setup | ||
### Step 1 - Declare "dd-sdk-android-compose" as a dependency | ||
Add `dd-sdk-android-compose` dependency to each module you want to instrument. This includes the application module, any Jetpack Compose UI modules, or feature modules using Jetpack Compose. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add `dd-sdk-android-compose` dependency to each module you want to instrument. This includes the application module, any Jetpack Compose UI modules, or feature modules using Jetpack Compose. | |
Add `dd-sdk-android-compose` as a dependency to each module you want to instrument. This includes the application module, any Jetpack Compose UI modules, or feature modules using Jetpack Compose. |
If your application uses Jetpack Compose, you can instrument it manually or automatically with the Datadog Gradle Plugin. This enables Real User Monitoring (RUM) similar to what is available for Android classic Views. | ||
|
||
<div class="alert alert-info"><p>Note: The minimum supported Kotlin version is 1.9.23.</p></div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After initial setup, you can choose between [automatic](##automatic-instrumentation) and [manual](##manual-instrumentation) instrumentation. | |
{{< /tabs >}} | ||
|
||
## Automatic Instrumentation | ||
As described in the [Setup section][2], declare the [Datadog Gradle Plugin][3] in your build script and apply it to each module you want to instrument. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As described in the [Setup section][2], declare the [Datadog Gradle Plugin][3] in your build script and apply it to each module you want to instrument. | |
As described in Step 1 of the [Android setup section][2], declare the [Datadog Gradle Plugin][3] in your build script and apply it to each module you want to instrument. |
- `InstrumentationMode.ANNOTATION`: Only instruments `@Composable` functions annotated with `@ComposeInstrumentation`. You can define the scope of auto-instrumentation by using this annotation. | ||
- `InstrumentationMode.DISABLE`: Disables instrumentation completely. | ||
|
||
Note: if you don't declare `composeInstrumentation` in `datadog` block, the auto-instrumentation is disabled by default. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: if you don't declare `composeInstrumentation` in `datadog` block, the auto-instrumentation is disabled by default. | |
**Note**: if you don't declare `composeInstrumentation` in `datadog` block, the auto-instrumentation is disabled by default. |
{{< /tabs >}} | ||
|
||
### Setup 2 - Select the instrumentation mode | ||
In your module’s Gradle configuration, define the desired Compose instrumentation mode: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In your module’s Gradle configuration, define the desired Compose instrumentation mode: | |
In your module's Gradle configuration, define the desired Compose instrumentation mode: |
{{% /tab %}} | ||
{{< /tabs >}} | ||
|
||
## Automatic Instrumentation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
## Automatic Instrumentation | |
## Automatic Instrumentation | |
For full RUM coverage with minimal setup, you can automatically instrument your Jetpack Compose application. |
As described in the [Setup section][2], declare the [Datadog Gradle Plugin][3] in your build script and apply it to each module you want to instrument. | ||
|
||
<div class="alert alert-info"><p> | ||
The Datadog Gradle Plugin scans @Composable functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects NavHost usage and listens to Jetpack Compose navigation events. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
actually, you could do this:
The Datadog Gradle Plugin scans @Composable functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects NavHost usage and listens to Jetpack Compose navigation events. | |
The Datadog Gradle Plugin scans <code>@Composable</code> functions and adds Semantics tags to their modifiers. These tags allow Datadog RUM to track user interactions on Compose components with the correct target information. The plugin also detects <code>NavHost</code> usage and listens to Jetpack Compose navigation events. |
What does this PR do? What is the motivation?
Add documentation page to explain how to instrument Jetpack Compose manually or automatically using the Datadog Gradle Plugin.
Merge instructions
Merge readiness:
dd-sdk-android
2.21.0dd-sdk-android-gradle-plugin
1.17.0For Datadog employees:
Merge queue is enabled in this repo. Your branch name MUST follow the
<name>/<description>
convention and include the forward slash (/
). Without this format, your pull request will not pass in CI, the GitLab pipeline will not run, and you won't get a branch preview. Getting a branch preview makes it easier for us to check any issues with your PR, such as broken links.If your branch doesn't follow this format, rename it or create a new branch and PR.
To have your PR automatically merged after it receives the required reviews, add the following PR comment:
Additional notes